A graphics processing unit (GPU) is a dedicated graphics rendering device utilized to manipulate and display graphics images on a display device. GPUs are often built with a highly-parallel structure that provides more efficient processing than typical, general-purpose central processing units (CPUs) for a range of complex algorithms. For example, the complex algorithms may correspond to processing representations of three-dimensional computerized graphics. A GPU may implement a number of primitive graphics operations, such as forming points, lines, and triangles, to create complex, two-dimensional or three-dimensional images on a display device more quickly than drawing the images directly to the display device with a CPU.
Vertex shading and fragment (pixel) shading are often utilized in the video gaming industry to determine final surface properties of a computerized image. GPUs typically include at least three major pipeline stages in a typical shader-based graphics core: a vertex shader stage, a primitive setup and interpolation stage, and a fragment shader stage.
A vertex shader may be applied to an image geometry for an image and may generate vertex coordinates and vertex attributes for primitives contained within the image geometry. Vertex attributes may include, for example, color, normal, and texture coordinates associated with a vertex. A primitive setup module may form primitives, such as points, lines, or triangles. Primitives for the image geometry may be converted into pixels, and hidden primitive and pixel removal (hidden surface removal) may be performed. An attribute interpolator then interpolates the attributes over pixels within the primitives for the image geometry, and sends the interpolated attribute values to the fragment shader for pixel rendering. Results from the fragment shader may then be output to a post-processing block and a frame buffer for presentation of the processed image on the display device.
In certain instances, a device may perform multiple passes, or iterations, through a specific GPU processing pipeline in order to render image data. A first pass through the GPU pipeline may only fetch attributes and perform vertex shading computation related to vertex coordinates and position. During the first pass, the GPU pipeline may reject invisible primitives, and may store information related to the visible primitives in a memory buffer. In a second, subsequent pass through the GPU pipeline, the GPU pipeline retrieves the information from the memory buffer, processes only the visible primitives, and completes the vertex shading computations.